#ifndef TOOL_H
#define TOOL_H

#include <QList>
#include <QObject>
#include <QKeyEvent>
#include <qpoint.h>

namespace Editor {
    class VertexItem;
    class EdgeItem;
    class EditWidget;
}

namespace Editor {

/**
 * Editor tool.
 * \description This is an interface that all editor tools must
 * implement. Note that not all events must be handled, only
 * those which are useful for the current task. By default,
 * mouseMove() sets the mousePos property to the current value.
 * If you override it, you must manually set the value of mousePos.
 */
class Tool : public QObject
{
Q_OBJECT

public:
    Tool();
    
    virtual void leftButtonPressed() = 0;  ///< Called when the left button of the mouse is pressed.
    virtual void leftButtonReleased() = 0; ///< Called when the left button of the mouse is released.
    
    virtual void rightButtonPressed() = 0;  ///< Called when the right button of the mouse is pressed.
    virtual void rightButtonReleased() = 0; ///< Called when the right button of the mouse is released.
    
    /**
     * Called at every mouse move event with the new coordinates of the mouse.
     * \param p The coordinates of the mouse. These coordinates are given in scene space, i.e.
     * they are translated from the screen space to the float-precision space of the current map.
     */
    virtual void mouseMove(QPointF p);
    
    /**
     * Called when a key is pressed. Use for specific actions
     * TODO: Does keyPress() gives ownership of the event?
     */
    virtual void keyPressEvent(QKeyEvent*);
    
    virtual ~Tool();
    
protected:
    QPointF mousePos;
    
signals:
    /**
     * Signal emitted each time a modification has been made to the scene and 
     * the widgets has to refresh.
     */
    void sceneChanged();
};

}

#endif // EDITTOOL_H
